home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / utilities / blankers / blitzblank_260 / developer / modulesources / bb.melt.c < prev    next >
C/C++ Source or Header  |  1995-02-28  |  3KB  |  126 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5. #include <dos/dos.h>
  6. #include <exec/memory.h>
  7. #include <intuition/intuitionbase.h>
  8. #include <intuition/screens.h>
  9. #include <intuition/intuition.h>
  10. #include <proto/exec.h>
  11. #include <proto/intuition.h>
  12. #include <proto/graphics.h>
  13. #include <pragmas/blitzblank_pragmas.h>
  14.  
  15. #include <BlitzBlank.h>
  16.  
  17. struct Library *BlitzBlankBase;
  18. static const char version[]="$VER: BB.Melt 2.50 (25.12.94)";
  19.  
  20. char *text[]={"\33c\33uMelt\33n\n\nModule for BlitzBlank\n\nCopyright 1994\nby\nThomas Börkel",
  21.               "Sp_eed:",
  22.               "Si_ze:",
  23.               "R_efresh Cycle:",
  24.               "_Brightness:",
  25.               "_Delay:" };
  26.  
  27. struct BB_Object object[]={ {&object[1],BB_VGroup,0,0,0,NULL,NULL},
  28.                             {&object[2],BB_Slider,1,150,100,NULL,NULL},
  29.                             {&object[3],BB_Slider,1,100,30,NULL,NULL},
  30.                             {&object[4],BB_Slider,10,500,100,NULL,NULL},
  31.                             {&object[5],BB_Slider,0,100,70,NULL,NULL},
  32.                             {&object[6],BB_Slider,0,20,1,NULL,NULL},
  33.                             {NULL,BB_VGroup_End,0,0,0,NULL,NULL} };
  34.  
  35. struct BB_Message message;
  36. struct BB_Screeninfo *screeninfo;
  37.  
  38.  
  39. void blank (void)
  40. {
  41.   int i,x,y,c;
  42.   long a=0;
  43.   struct RastPort *rp;
  44.  
  45.   rp=&screeninfo->bbscreen->RastPort;
  46.  
  47.   c=BBL_GetDarkestPen (screeninfo->bbscreen);
  48.  
  49.   ScreenToFront (screeninfo->bbscreen);
  50.  
  51.   if (!CheckSignal (SIGBREAKF_CTRL_C))
  52.   {
  53.     BBL_ModuleRunning ();
  54.     if (BBL_FadeDown (screeninfo->bbscreen,object[4].set,object[5].set))
  55.     {
  56.       SetAPen (rp,c);
  57.       Move (rp,0,0);
  58.       Draw (rp,screeninfo->width-1,0);
  59.       do
  60.       {
  61.         WaitTOF ();
  62.         for (i=1;i<=object[1].set+30;i++)
  63.         {
  64.           x=drand48 ()*(screeninfo->width-object[2].set+1);
  65.           y=drand48 ()*(screeninfo->height-3);
  66.     //      if (ReadPixel (rp,x,y))
  67.     //      {
  68.             BltBitMap (rp->BitMap,x,y,rp->BitMap,x,y+1,object[2].set,1,0xc0,0xff,0);
  69.             BltBitMap (rp->BitMap,x,y,rp->BitMap,x,y+2,object[2].set,1,0xc0,0xff,0);
  70.             a++;
  71.     //      }
  72.           if (a>10000*object[3].set)
  73.           {
  74.             a=0;
  75.             BBL_CopyOriginalScreen (screeninfo->bbscreen);
  76.             SetAPen (rp,c);
  77.             Move (rp,0,0);
  78.             Draw (rp,screeninfo->width-1,0);
  79.           }
  80.         }
  81.       } while (!CheckSignal (SIGBREAKF_CTRL_C));
  82.     }
  83.   }
  84.   return;
  85. }
  86.  
  87.  
  88. void main (int argc,char **argv)
  89. {
  90.   int i;
  91.  
  92.   if (!(BlitzBlankBase=OpenLibrary ("blitzblank.library",BLITZBLANKLIB_VER)))
  93.     exit (0);
  94.  
  95.   message.flags=BBF_CloneScreen|BBF_Interleaved;
  96.   message.first=&object[0];
  97.  
  98.  
  99.   if (strcmp (argv[1],"BLANK")==0)
  100.   {
  101.     StrToLong (argv[3],(long *) &screeninfo);
  102.     BBL_SendMessage (&message,argv[2]);
  103.     if (screeninfo->bbscreen)
  104.       blank ();
  105.     BBL_BlankDone ();
  106.   }
  107.   else
  108.   {
  109.     message.infotext=BBL_GetString (200,text[0]);
  110.     for (i=1;i<=5;i++)
  111.       object[i].label=BBL_GetString (200+i,text[i]);
  112.     if (strcmp (argv[1],"CONFIG")==0)
  113.     {
  114.       BBL_SendMessage (&message,argv[2]);
  115.     }
  116.     else
  117.     {
  118.       message.first=NULL;
  119.       BBL_SendMessage (&message,argv[2]);
  120.     }
  121.   }
  122.   CloseLibrary (BlitzBlankBase);
  123.   exit (0);
  124. }
  125.  
  126.